<template>
	<view>
		<navbar title="收益明细" :autoBack="true"></navbar>
		<view class="con">
			<scroll-view scroll-y="true" class="con__box" @scrolltolower="scrolltolower">
				<view class="con__box__list" v-if="list.length>0">
					<view class="con__box__list__item" v-for="(item,index) in list" :key="index">
						<view class="">
							<view class="con__box__list__item__name">
								{{item.username}}
							</view>
							<view class="con__box__list__item__time">
								<!-- 2023-04-11 14:38:54 -->
								{{$u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss')}}
							</view>
						</view>
						<view class="con__box__list__item__num">
							￥{{item.money}}
						</view>
					</view>
					<u-loadmore :status="status" fontSize='24rpx' color='#313131' :nomore-text="nomoreText" marginTop='50rpx' marginBottom='50rpx' />
					<view class="" style="height: 2rpx;">
						
					</view>
				</view>
				<u-empty mode="list" v-else>
				</u-empty>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import user from '@/api/_user.js'
	export default {
		data() {
			return {
				status: 'loadmore',
				list: [],
				page: 0,
				nomoreText:'~暂无更多~'
			};
		},
		methods:{
			scrolltolower(){
				if (this.page >= 3) return;
				this.status = 'loading';
				this.page = ++this.page;
				setTimeout(() => {
					this.list += 10;
					if (this.page >= 3) this.status = 'nomore';
					else this.status = 'loading';
				}, 2000)
			},
			async getlist(){
				let res = await user.moneyDetail()
				if(res.data.code==1){
					this.list=res.data.data
				}
			}
		},
		onLoad() {
			this.getlist()
		},
		onReachBottom() {
			
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f8f8f8;
	}

	.con {
		padding: 20rpx 30rpx;
		height: calc(100vh - 44px - var(--status-bar-height) - 40rpx);

		&__box {
			height: 100%;
			background: #FFFFFF;
			border-radius: 20rpx;

			&__list {
				padding: 12rpx 0 0 26rpx;

				&__item {
					padding: 39rpx 32rpx 29rpx 16rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					border-bottom: 1rpx solid #F4F4F4;

					&__name {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 26rpx;
						color: #2C2C2C;
						line-height: 26rpx;
					}

					&__time {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 22rpx;
						color: #888888;
						line-height: 18rpx;
						margin-top: 17rpx;
					}

					&__num {
						font-family: PingFang SC;
						font-weight: 800;
						font-size: 29rpx;
						color: #313131;

					}
				}
			}
		}
	}
</style>